package com.shuyuansystem.controller;

import com.shuyuansystem.utils.JWTUtils;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/OrderPay")
public class OrderPayController {
    @RequestMapping("/getOrderPayList")
    public void getOrderPayList(@RequestHeader("Authorization") String token) {
        try {
            // 去除 Bearer 前缀
            token = token.replace("Bearer ", "");
            // 从 Token 中获取用户 ID
            String userId = JWTUtils.getUserIdFromToken(token);
            if (userId != null) {
                System.out.println(userId);
            } else {
                System.out.println("无法从 Token 中获取用户 ID");
            }
        } catch (Exception e) {
            System.out.println("处理请求时发生错误: " + e.getMessage());
        }
    }
}
